home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Utilities / Miscellaneous / CopyPaste 3.3.4 / CopyPaste Tools Sourcecode / XTND Import / XTNDTextTranslator.p < prev   
Encoding:
Text File  |  1996-08-20  |  12.1 KB  |  304 lines  |  [TEXT/PJMM]

  1. {************************************************************************}
  2. {*                                                                        *}
  3. {*    XTNDTextTranslator.p                                                *}
  4. {*                                                                        *}
  5. {*    Header file for text translators.                                    *}
  6. {*                                                                        *}
  7. {*    Copyright © 1988-91 Claris Corporation                                *}
  8. {*    All Rights Reserved                                                    *}
  9. {*                                                                        *}
  10. {************************************************************************}
  11.  
  12. UNIT XTNDTextTranslator;
  13. INTERFACE
  14.     USES
  15. {dialogs, printing, XTNDInterface;}
  16.         printing, XTNDInterface;
  17.  
  18.  
  19.     CONST
  20.  
  21. { Directives to be passed to import translators }
  22.         importAcknowledge = -1;    { Value set by a translator to acknowledge an action }
  23.  
  24.         importGetResources = 0;
  25.         importInitAll = 1;
  26.  
  27.         importInitRightHeader = 2;
  28.         importInitLeftHeader = 3;
  29.         importInitHeader = 4;
  30.  
  31.         importInitRightFooter = 5;
  32.         importInitLeftFooter = 6;
  33.         importInitFooter = 7;
  34.  
  35.         importInitMain = 8;
  36.  
  37.         importInitFootnote = 9;
  38.  
  39.         importGetText = 10;
  40.  
  41.         importCloseRightHeader = 11;
  42.         importCloseLeftHeader = 12;
  43.         importCloseHeader = 13;
  44.  
  45.         importCloseRightFooter = 14;
  46.         importCloseLeftFooter = 15;
  47.         importCloseFooter = 16;
  48.  
  49.         importCloseMain = 17;
  50.  
  51.         importCloseFootnote = 18;
  52.  
  53.         importCloseAll = 19;
  54.  
  55. { Directives to be passed to export translators }
  56.         exportAcknowledge = -1;    { Set by translators to acknowledge certain directives }
  57.  
  58.         exportInitAll = 0;
  59.  
  60.         exportOpenRightHeader = 1;
  61.         exportOpenLeftHeader = 2;
  62.         exportOpenHeader = 3;
  63.  
  64.         exportOpenRightFooter = 4;
  65.         exportOpenLeftFooter = 5;
  66.         exportOpenFooter = 6;
  67.  
  68.         exportOpenFootnote = 7;
  69.  
  70.         exportOpenMain = 8;
  71.  
  72.         exportWriteText = 9;
  73.  
  74.         exportCloseRightHeader = 10;
  75.         exportCloseLeftHeader = 11;
  76.         exportCloseHeader = 12;
  77.  
  78.         exportCloseRightFooter = 13;
  79.         exportCloseLeftFooter = 14;
  80.         exportCloseFooter = 15;
  81.  
  82.         exportCloseFootnote = 16;
  83.  
  84.         exportCloseMain = 17;
  85.  
  86.         exportCloseAll = 18;
  87.  
  88.         exportWriteResources = 19;
  89.  
  90.  
  91. { Defines for CurrentStory }
  92.         rightHeaderStory = 1;
  93.         leftHeaderStory = 2;
  94.         headerStory = 3;
  95.         rightFooterStory = 4;
  96.         leftFooterStory = 5;
  97.         footerStory = 6;
  98.         footnoteStory = 7;
  99.         mainStory = 8;
  100.  
  101. { types of pages for headers/footers }
  102.         everyPage = 1;
  103.         leftPage = 2;
  104.         rightPage = 4;
  105.  
  106. { XTND 1.x reserved characters }
  107.         pageNumber = $02;    { Current page number character }
  108.         footnoteChar = $03;    { Footnote character in the footnote }
  109.         floatingPict = $04;    { Floating picture marker }
  110.         footnoteMark = $05;    { Footnote character in the text }
  111.         mergeBreak = $06;    { Mail merge document break }
  112.         hardReturn = $07;    { Hard return (does not create new paragraph) }
  113.         tabChar = $09;    { Tab character }
  114.         newColumn = $0B;    { Column break character }
  115.         newPage = $0C;    { Page break character }
  116.         returnChar = $0D;    { Paragraph break character }
  117.         shortDateChar = $15;    { Assorted date characters }
  118.         abbrDateChar = $16;
  119.         longDateChar = $17;
  120.         dayAbbrDateChar = $18;    { Date characters with day of week included }
  121.         dayLongDateChar = $19;
  122.         timeChar = $1A;    { Time character }
  123.         softHyphen = $1F;    { Discretionary hyphen character }
  124.  
  125.     { Other character values }
  126.         enterChar = $03;
  127.  
  128.     { XTND 1.x limits }
  129.         numParaFmts = 9;            { Number of fields in a paragraph specification }
  130.         maxCols = 10;            { Maximum number of columns allowed }
  131.         maxTabs = 20;            { Maximum number of tabs allowed }
  132.         minGutter = $00030000;    { (minimum gutter) 3 points as a Fixed number }
  133.         maxGutter = $01200000;    { (maximum gutter) 288 points as a Fixed number }
  134.         dfltGutter = $00090000;    { (default gutter) 9 points as a Fixed number }
  135.  
  136. { XTND 1.x text styles }
  137.         textPlain = $0000;
  138.         textSuperScript = $0020;
  139.         textSubScript = $0040;
  140.         textNonbreaking = $0080;
  141.         textSuperior = $0100;
  142.         textStrikeThru = $0200;
  143.         textAllCaps = $0400;
  144.         textSmallCaps = $0800;
  145.         textWordUnderline = $1000;
  146.         textDoubleUnderline = $2000;
  147.         textLowerCase = $4000;
  148.  
  149. { XTND 1.x justification/tab alignment values }
  150.         textLeft = 0;
  151.         textCenter = 1;
  152.         textRight = 2;
  153.         textJustified = 3;        { For text }
  154.         textDecimal = 3;        { For tabs }
  155.  
  156. { XTND 1.x text color values }
  157.         textWhite = 0;
  158.         textBlack = 1;
  159.         textRed = 2;
  160.         textGreen = 3;
  161.         textBlue = 4;
  162.         textCyan = 5;
  163.         textMagenta = 6;
  164.         textYellow = 7;
  165.         textOtherColor = 8;
  166.  
  167.     TYPE
  168.     { Tab specifications record.  The tab array contains 20 of these.}
  169.         TabSpec = RECORD
  170.                 tabJust: SignedByte;    { Tab justification (left, right, center, aligned) }
  171.                 tabLead: SignedByte;    { Tab leader character (default is space) }
  172.                 tabIndent: Fixed;        { Tab indent in points from left page margin }
  173.                 decAlign: SignedByte;    { Tab alignment character (usually period) }
  174.             END;
  175.         TabSpecArray = ARRAY[0..19] OF TabSpec;
  176.  
  177.  
  178.     { The pictMisc data structure is used to import a quickdraw picture }
  179.         pictMiscHdl = ^pictMiscPtr;
  180.         pictMiscPtr = ^pictMisc;
  181.         pictMisc = RECORD
  182.                 thePicture: PicHandle;        { handle to the quickdraw picture }
  183.                 pictSize: LongInt;        { Size of associated picture }
  184.                 destRect: Rect;            { Used for scaling the picture, OrigRect will be scaled to this rect }
  185.                 origRect: Rect;            { Used for cropping the picture, pictRect will be cropped to this rect }
  186.                 reserved: PACKED ARRAY[1..38] OF Byte;    { Reserved, fill with zeros }
  187.             END;
  188.  
  189.     { Paragraph format record.  The ParaFormats array contains 9 Fixed values }
  190.         ParaFormat = Fixed;
  191.         ParaFormats = ARRAY[0..8] OF ParaFormat;
  192.  
  193.     { This is the parameter block for passing information to an import translator }
  194.         ImportParmBlkPtr = ^ImportParmBlock;
  195.         ImportParmBlock = RECORD
  196.                 textBuffer: Ptr;        { Pointer to 256 bytes of data }
  197.                 directive: INTEGER;    { Indicates the action to be performed }
  198.                 result: OSErr;        { Return code, 0 if successful, error code otherwise }
  199.                 textLength: LONGINT;    { Number of characters of information being returned }
  200.                 translatorState: INTEGER;    { Available for use by the translator }
  201.                 refNum: INTEGER;    { Reference number of the fork to be read by the translator }
  202.                 txtFace: INTEGER;    { Current text face }
  203.                 txtSize: INTEGER;    { Current text font size }
  204.                 txtFont: INTEGER;    { Current text font family number }
  205.                 txtColor: INTEGER;    { Current text color (MacWrite II color value) }
  206.                 txtJust: INTEGER;    { Justification of this text }
  207.                 unused1: INTEGER;    { Must be zero }
  208.                 paraFmts: ^ParaFormats;    { Pointer to this paragraph's format array }
  209.                 tabs: ^TabSpecArray;{ Pointer to this paragraph's tab array }
  210.                 unused2: BOOLEAN;    { Currently unused }
  211.                 numCols: SignedByte;    { Number of columns expected }
  212.                 currentStory: INTEGER;    { Header,Footer,Main Body, etc. }
  213.                 miscData: LONGINT;    { For importing pictures, etc. }
  214.                 storyHeight: INTEGER;    { Height of header,footer, etc. }
  215.                 decimalChar: Char;        { Default char to align decimal tab on }
  216.                 autoHyphenate: BOOLEAN;    { If TRUE, auto hyphenation is on }
  217.                 printRecord: THPrint;    { Print record, if one is used, otherwise NIL }
  218.                 topMargin: Fixed;        { Document top margin }
  219.                 bottomMargin: Fixed;    { Document bottom margin }
  220.                 leftMargin: Fixed;        { Document left margin }
  221.                 rightMargin: Fixed;        { Document right margin }
  222.                 gutter: Fixed;            { Space between columns }
  223.                 startPageNum: INTEGER;    { Starting page number }
  224.                 startFootnoteNum: INTEGER;    { starting footnote number }
  225.                 footnoteText: Ptr;        { If not empty, text associated with footnote, else auto }
  226.                 rulerShowing: BOOLEAN;    { If TRUE, ruler is showing }
  227.                 doubleSided: BOOLEAN;    { If TRUE, document has Left/Right pages }
  228.                 titlePage: BOOLEAN;    { If TRUE, document has a title page (with no headers/footers) }
  229.                 endnotes: BOOLEAN;    { If TRUE, footnotes are displayed as endnotes }
  230.                 showInvisibles: BOOLEAN;    { If TRUE, invisible characters will be displayed }
  231.                 showPageGuides: BOOLEAN;    { If TRUE, page guides will be displayed }
  232.                 showPictures: BOOLEAN;    { If TRUE, pictures will be displayed }
  233.                 autoFootnotes: BOOLEAN;    { If TRUE, footnotes will be numbered automatically }
  234.                 pagePoint: Point;        { Position for page number within header/footer }
  235.                 datePoint: Point;        { Position for date character within header/footer }
  236.                 timePoint: Point;        { Position for time character within header/footer }
  237.                 globalHandle: Handle;        { Handle to translator globals, if needed }
  238.                 smartQuotes: BOOLEAN;    { If TRUE, smart quotes will be used }
  239.                 fractCharWidths: BOOLEAN;    { If TRUE, fractional character widths will be used }
  240.                 hRes: INTEGER;    { The horizontal resolution of this document (default is 72) }
  241.                 vRes: INTEGER;    { The vertical resolution of this document (default is 72) }
  242.                 windowRect: Rect;        { May be used to specify document window placement and size }
  243.                 theReply: SFReply;    { Standard reply record describing the file being translated }
  244.                 thisTranslator: TransDescribe;{ TransDescribe record describing this translator }
  245.             END;
  246.  
  247.  
  248.     { This is the parameter block for passing information to an export translator.}
  249.         ExportParmBlkPtr = ^ExportParmBlock;
  250.         ExportParmBlock = RECORD
  251.                 directive: SignedByte;    { Indicates the action to be performed }
  252.                 filler1: SignedByte;    { explicit padding }
  253.                 result: ^OSErr;        { Pointer to return code, 0 if successful, error code otherwise }
  254.                 refNum: ^INTEGER;    { Pointer to reference number of the file being written by the translator }
  255.                 textLength: ^LONGINT;    { Pointer to number of characters being exported }
  256.                 globalHandle: Handle;        { Do not change this value }
  257.                 reserved1: LONGINT;    { Do not change this value }
  258.                 textBuffer: Handle;        { Handle to the text being exported }
  259.                 txtFace: ^INTEGER;    { Pointer to the current text face }
  260.                 txtSize: ^INTEGER;    { Pointer to the current text font size }
  261.                 txtFont: ^INTEGER;    { Pointer to the current text font family number }
  262.                 txtColor: ^SignedByte;{ Pointer to the current text color (MacWrite II color value) }
  263.                 txtJust: ^INTEGER;    { Pointer to the justification of this text }
  264.                 paraFmts: ^ParaFormats;        { Pointer to this paragraph's format array }
  265.                 tabs: ^TabSpecArray;{ Pointer to this paragraph's tab array }
  266.                 thePicture: PicHandle;    { Handle to a quickdraw picture }
  267.                 pictRect: Rect;        { Rectangle describing the display rect of the above picture }
  268.                 headerStatus: INTEGER;    { Shows if header is on left/right/every page }
  269.                 footerStatus: INTEGER;    { Shows if footer is on left/right/every page }
  270.                 currentStory: INTEGER;    { Header, Footer, Main Body, etc. }
  271.                 numCols: INTEGER;    { Number of columns in document }
  272.                 topMargin: Fixed;        { Document top margin }
  273.                 bottomMargin: Fixed;        { Document bottom margin }
  274.                 leftMargin: Fixed;        { Document left margin }
  275.                 rightMargin: Fixed;        { Document right margin }
  276.                 gutter: Fixed;        { Space between columns }
  277.                 totalCharCount: LONGINT;    { Total number of chars in document (for Word 3.0) }
  278.                 footnoteOffset: LONGINT;    { If current story is a footnote, its offset in doc }
  279.                 footnoteText: StringPtr;    { If !autoFootnotes, text for footnote (Pascal String) }
  280.                 startPageNum: INTEGER;    { Starting page number }
  281.                 startFootnoteNum: INTEGER;    { Starting footnote number }
  282.                 rulerShowing: BOOLEAN;    { if TRUE, ruler is showing }
  283.                 doubleSided: BOOLEAN;    { if TRUE, document has Left/Right pages }
  284.                 titlePage: BOOLEAN;    { If TRUE, document has a title page (with no headers/footers) }
  285.                 endnotes: BOOLEAN;    { If TRUE, footnotes are displayed as endnotes }
  286.                 showInvisibles: BOOLEAN;    { If TRUE, invisible characters are displayed }
  287.                 showPageGuides: BOOLEAN;    { If TRUE, page guides are displayed }
  288.                 showPictures: BOOLEAN;    { If TRUE, pictures are displayed }
  289.                 autoFootnotes: BOOLEAN;    { If TRUE, footnotes are numbered automatically }
  290.                 footnotesExist: BOOLEAN;    { If TRUE, footnotes are being exported }
  291.                 printRecord: THPrint;    { Print record for this document }
  292.                 pagePoint: Point;        { Point where page number is displayed in header or footer }
  293.                 datePoint: Point;        { Point where date character is displayed in header or footer }
  294.                 timePoint: Point;        { Point where time character is displayed in header or footer }
  295.                 smartQuotes: BOOLEAN;    { If TRUE, SmartQuotes are turned on }
  296.                 fractCharWidths: BOOLEAN;    { If TRUE, fractional character widths are turned on }
  297.                 hRes: INTEGER;    { The horizontal resolution of this document }
  298.                 vRes: INTEGER;    { The vertical resolution of this document }
  299.                 windowRect: Rect;        { Rectangle specifying document window placement and size }
  300.                 theReply: SFReply;    { Standard reply record describing the file being written }
  301.                 thisTranslator: TransDescribe;{ TransDescribe record describing this translator }
  302.             END;
  303. IMPLEMENTATION
  304. END.